home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_dos.lha / dos / sphsrc / fallocde.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-26  |  1.8 KB  |  54 lines

  1. /** FALLOC : fallocdefs.h
  2. **/
  3.  
  4. /* $Id: fallocdefs.h,v 1.3 90/09/05 18:05:36 dfs Exp Locker: dfs $ */
  5.  
  6.  
  7. /* Define an alignment based on a type or an absolute size for any new machine
  8. ** or it will default to sizeof(double), at some small cost in space.
  9. */
  10.  
  11. #ifdef vax
  12. #define ALIGN_WORST 2
  13. #endif
  14.  
  15. #ifdef apollo
  16. #define ALIGN_WORST 2
  17. #endif
  18.  
  19. #ifndef ALIGN_WORST
  20. #define ALIGN_WORST (sizeof(double))
  21. #endif
  22.  
  23. #define ALIGN_SIZE (ALIGN_WORST - 1)
  24. #define ALIGN_MASK (~ALIGN_SIZE)
  25.  
  26. #define MALLOC_FATAL(P,T,N,M)                                           \
  27.         {                                                               \
  28.            if ((P = (T *) malloc((unsigned)(N)*sizeof(T))) == NULL) {   \
  29.              exit(fprintf(stderr, "falloc: MALLOC RETURNED NULL: %s\n", M)); \
  30.            }                                                            \
  31.         }
  32.  
  33. #define MALLOC_RET(P,T,N,R)                                             \
  34.         {                                                               \
  35.            if ((P = (T *) malloc((unsigned)(N)*sizeof(T))) == NULL) {   \
  36.               return R;                                                 \
  37.            }                                                            \
  38.         }
  39.  
  40. #define REALLOC_RET(P,T,N,R)                                            \
  41.         {                                                               \
  42.            if ((P = (T *) realloc((char *)P,                            \
  43.              (unsigned)(N)*sizeof(T))) == NULL) {                       \
  44.               return R;                                                 \
  45.            }                                                            \
  46.         }
  47.  
  48. #define FREE(P) free((char *) P)
  49.  
  50. #define SWAP(A, B, T) ((T) = (A), (A) = (B), (B) = (T));
  51. #define MAX(A, B) ((A) > (B) ? (A) : (B))
  52.  
  53. #define MAGIC ((int) 0xbad1)
  54.